package com.osdp.gateway.service.impl;

import com.osdp.gateway.service.ITokenService;
import com.osdp.gateway.util.CommonConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class TokenServiceImpl implements ITokenService {

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public Boolean checkToken(String token) {
        System.out.println("------TokenServiceImpl------token: "+ token);
        return restTemplate.getForObject(String.format("http://%s/auth/v1/rest/auth/token/verify?token=%s", CommonConstant.AUTH_APP_PATH, token), Boolean.class);
    }
}
